package com.wsc.wisdomchinaqinghe.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.wsc.wisdomchinaqinghe.R;
import com.wsc.wisdomchinaqinghe.javaBean.CompanyInfoSearchBean;

import java.util.List;

/**
 * 楼宇搜索适配器
 * Created by ${wangtao} on 2017/3/14.
 */

public class CompanySearchAdapter extends BaseAdapter {
    private Context context;
    private List<CompanyInfoSearchBean> messageBeen;

    public CompanySearchAdapter(Context context, List<CompanyInfoSearchBean> messageBeen) {
        this.context = context;
        this.messageBeen = messageBeen;
    }

    @Override
    public int getCount() {
        return messageBeen.size();
    }

    @Override
    public Object getItem(int position) {
        return messageBeen.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        ViewHolder holder = null;
        View view = convertView;
        if (view == null) {
            view= LayoutInflater.from(context).inflate(R.layout.item_floorsearch_layout,null);
            holder = new ViewHolder(view);
            view.setTag(holder);
        } else {
            holder = (ViewHolder) view.getTag();
        }
        holder.item_lyss_textView.setText(messageBeen.get(position).getCompanyName());
        return view;
    }

    public class ViewHolder {

        private TextView item_lyss_textView;

        public ViewHolder(View view) {
            item_lyss_textView = (TextView) view.findViewById(R.id.item_lyss_textView);
        }
    }
}
